﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once
#include "GcmpModelInterface.h"
#include "IObject.h"
#include "OwnerPtr.h"
#include <map>

namespace gcmp
{
    class ICopyContext;
    class Document;
    class IDocument;
    class Vector2d;
    class Vector3d;
    class ElementId;
    struct ElementIdHash;

    /// \brief 粘贴上下文接口
    FINAL_INTERFACE class GCMP_MODEL_INTERFACE_EXPORT IPasteContext : public IObject
    {
    public:
        // 临时性接口，因GBMP实现剪切板时需要去掉所有的非接口调用而暴露，不确定最终是否暴露 
        /// \brief 创建一个粘贴上下文
        /// \param opCopyContext 与粘贴上下文对应的复制上下文
        /// \param pSourceDocument 粘贴来源文档
        /// \param fromPoint 粘贴来源点
        /// \param targetPoint 粘贴目标点
        /// \param newToOldIdMap 目标Element的Id与源Element的Id之间的映射
        /// \return 返回创建出的粘贴上下文
        static OwnerPtr<IPasteContext> Create(
            OwnerPtr<ICopyContext> opCopyContext,
            IDocument* pSourceDocument,
            const Vector3d& fromPoint,
            const Vector3d& targetPoint,
            const std::unordered_map<ElementId, ElementId, ElementIdHash>& newToOldIdMap);
    
    public:
        /// \brief 获取这次粘贴使用到的复制上下文
        ///
        /// \return 返回复制上下文
        virtual const ICopyContext * GetCopyContext(void) const = 0;

        /// \brief 获取Z向偏移距离
        ///
        /// \return double 竖直偏移距离
        virtual double GetOffsetDistanceAlongZDirection(void) const = 0;

        /// \brief 获取XY平面内的偏移向量
        ///
        /// \return Vector2d 水平偏移向量
        virtual Vector2d GetOffsetVector2dInXYPlane(void) const = 0;

    public:
        /// \brief 析构函数
        virtual ~IPasteContext(void) = 0;
    };
}

